Optimal. Leaf size=128 \[ -\left (\left (a^4-6 a^2 b^2+b^4\right ) x\right )+\frac {4 a b \left (a^2-b^2\right ) \log (\cos (c+d x))}{d}-\frac {b^2 \left (3 a^2-b^2\right ) \tan (c+d x)}{d}-\frac {a b (a+b \tan (c+d x))^2}{d}-\frac {b (a+b \tan (c+d x))^3}{3 d}+\frac {(a+b \tan (c+d x))^5}{5 b d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.11, antiderivative size = 128, normalized size of antiderivative = 1.00, number of steps
used = 5, number of rules used = 5, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.238, Rules used = {3624, 3563,
3609, 3606, 3556} \begin {gather*} -\frac {b^2 \left (3 a^2-b^2\right ) \tan (c+d x)}{d}+\frac {4 a b \left (a^2-b^2\right ) \log (\cos (c+d x))}{d}-x \left (a^4-6 a^2 b^2+b^4\right )+\frac {(a+b \tan (c+d x))^5}{5 b d}-\frac {b (a+b \tan (c+d x))^3}{3 d}-\frac {a b (a+b \tan (c+d x))^2}{d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3563
Rule 3606
Rule 3609
Rule 3624
Rubi steps
\begin {align*} \int \tan ^2(c+d x) (a+b \tan (c+d x))^4 \, dx &=\frac {(a+b \tan (c+d x))^5}{5 b d}-\int (a+b \tan (c+d x))^4 \, dx\\ &=-\frac {b (a+b \tan (c+d x))^3}{3 d}+\frac {(a+b \tan (c+d x))^5}{5 b d}-\int (a+b \tan (c+d x))^2 \left (a^2-b^2+2 a b \tan (c+d x)\right ) \, dx\\ &=-\frac {a b (a+b \tan (c+d x))^2}{d}-\frac {b (a+b \tan (c+d x))^3}{3 d}+\frac {(a+b \tan (c+d x))^5}{5 b d}-\int (a+b \tan (c+d x)) \left (a \left (a^2-3 b^2\right )+b \left (3 a^2-b^2\right ) \tan (c+d x)\right ) \, dx\\ &=-\left (a^4-6 a^2 b^2+b^4\right ) x-\frac {b^2 \left (3 a^2-b^2\right ) \tan (c+d x)}{d}-\frac {a b (a+b \tan (c+d x))^2}{d}-\frac {b (a+b \tan (c+d x))^3}{3 d}+\frac {(a+b \tan (c+d x))^5}{5 b d}-\left (4 a b \left (a^2-b^2\right )\right ) \int \tan (c+d x) \, dx\\ &=-\left (a^4-6 a^2 b^2+b^4\right ) x+\frac {4 a b \left (a^2-b^2\right ) \log (\cos (c+d x))}{d}-\frac {b^2 \left (3 a^2-b^2\right ) \tan (c+d x)}{d}-\frac {a b (a+b \tan (c+d x))^2}{d}-\frac {b (a+b \tan (c+d x))^3}{3 d}+\frac {(a+b \tan (c+d x))^5}{5 b d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 0.77, size = 122, normalized size = 0.95 \begin {gather*} \frac {15 i (a+i b)^4 \log (i-\tan (c+d x))-15 i (a-i b)^4 \log (i+\tan (c+d x))+30 b^2 \left (-6 a^2+b^2\right ) \tan (c+d x)-60 a b^3 \tan ^2(c+d x)-10 b^4 \tan ^3(c+d x)+\frac {6 (a+b \tan (c+d x))^5}{b}}{30 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.04, size = 176, normalized size = 1.38
method | result | size |
norman | \(\left (-a^{4}+6 a^{2} b^{2}-b^{4}\right ) x +\frac {\left (a^{4}-6 a^{2} b^{2}+b^{4}\right ) \tan \left (d x +c \right )}{d}+\frac {a \,b^{3} \left (\tan ^{4}\left (d x +c \right )\right )}{d}+\frac {b^{4} \left (\tan ^{5}\left (d x +c \right )\right )}{5 d}+\frac {b^{2} \left (6 a^{2}-b^{2}\right ) \left (\tan ^{3}\left (d x +c \right )\right )}{3 d}+\frac {2 a b \left (a^{2}-b^{2}\right ) \left (\tan ^{2}\left (d x +c \right )\right )}{d}-\frac {2 a b \left (a^{2}-b^{2}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d}\) | \(158\) |
derivativedivides | \(\frac {\frac {b^{4} \left (\tan ^{5}\left (d x +c \right )\right )}{5}+a \,b^{3} \left (\tan ^{4}\left (d x +c \right )\right )+2 a^{2} b^{2} \left (\tan ^{3}\left (d x +c \right )\right )-\frac {b^{4} \left (\tan ^{3}\left (d x +c \right )\right )}{3}+2 a^{3} b \left (\tan ^{2}\left (d x +c \right )\right )-2 a \,b^{3} \left (\tan ^{2}\left (d x +c \right )\right )+a^{4} \tan \left (d x +c \right )-6 a^{2} b^{2} \tan \left (d x +c \right )+b^{4} \tan \left (d x +c \right )+\frac {\left (-4 a^{3} b +4 a \,b^{3}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (-a^{4}+6 a^{2} b^{2}-b^{4}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) | \(176\) |
default | \(\frac {\frac {b^{4} \left (\tan ^{5}\left (d x +c \right )\right )}{5}+a \,b^{3} \left (\tan ^{4}\left (d x +c \right )\right )+2 a^{2} b^{2} \left (\tan ^{3}\left (d x +c \right )\right )-\frac {b^{4} \left (\tan ^{3}\left (d x +c \right )\right )}{3}+2 a^{3} b \left (\tan ^{2}\left (d x +c \right )\right )-2 a \,b^{3} \left (\tan ^{2}\left (d x +c \right )\right )+a^{4} \tan \left (d x +c \right )-6 a^{2} b^{2} \tan \left (d x +c \right )+b^{4} \tan \left (d x +c \right )+\frac {\left (-4 a^{3} b +4 a \,b^{3}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (-a^{4}+6 a^{2} b^{2}-b^{4}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) | \(176\) |
risch | \(-4 i a^{3} b x +4 i a \,b^{3} x -a^{4} x +6 a^{2} b^{2} x -b^{4} x -\frac {8 i a^{3} b c}{d}+\frac {8 i a \,b^{3} c}{d}+\frac {2 i \left (-60 i a^{3} b \,{\mathrm e}^{8 i \left (d x +c \right )}-60 i a^{3} b \,{\mathrm e}^{2 i \left (d x +c \right )}+15 a^{4} {\mathrm e}^{8 i \left (d x +c \right )}-180 a^{2} b^{2} {\mathrm e}^{8 i \left (d x +c \right )}+45 b^{4} {\mathrm e}^{8 i \left (d x +c \right )}+240 i a \,b^{3} {\mathrm e}^{6 i \left (d x +c \right )}+120 i a \,b^{3} {\mathrm e}^{2 i \left (d x +c \right )}+60 a^{4} {\mathrm e}^{6 i \left (d x +c \right )}-540 a^{2} b^{2} {\mathrm e}^{6 i \left (d x +c \right )}+90 b^{4} {\mathrm e}^{6 i \left (d x +c \right )}-180 i a^{3} b \,{\mathrm e}^{4 i \left (d x +c \right )}+120 i a \,b^{3} {\mathrm e}^{8 i \left (d x +c \right )}+90 a^{4} {\mathrm e}^{4 i \left (d x +c \right )}-660 a^{2} b^{2} {\mathrm e}^{4 i \left (d x +c \right )}+140 b^{4} {\mathrm e}^{4 i \left (d x +c \right )}+240 i a \,b^{3} {\mathrm e}^{4 i \left (d x +c \right )}-180 i a^{3} b \,{\mathrm e}^{6 i \left (d x +c \right )}+60 a^{4} {\mathrm e}^{2 i \left (d x +c \right )}-420 a^{2} b^{2} {\mathrm e}^{2 i \left (d x +c \right )}+70 b^{4} {\mathrm e}^{2 i \left (d x +c \right )}+15 a^{4}-120 a^{2} b^{2}+23 b^{4}\right )}{15 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{5}}+\frac {4 b \,a^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{d}-\frac {4 b^{3} a \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{d}\) | \(449\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.52, size = 149, normalized size = 1.16 \begin {gather*} \frac {3 \, b^{4} \tan \left (d x + c\right )^{5} + 15 \, a b^{3} \tan \left (d x + c\right )^{4} + 5 \, {\left (6 \, a^{2} b^{2} - b^{4}\right )} \tan \left (d x + c\right )^{3} + 30 \, {\left (a^{3} b - a b^{3}\right )} \tan \left (d x + c\right )^{2} - 15 \, {\left (a^{4} - 6 \, a^{2} b^{2} + b^{4}\right )} {\left (d x + c\right )} - 30 \, {\left (a^{3} b - a b^{3}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 15 \, {\left (a^{4} - 6 \, a^{2} b^{2} + b^{4}\right )} \tan \left (d x + c\right )}{15 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.99, size = 148, normalized size = 1.16 \begin {gather*} \frac {3 \, b^{4} \tan \left (d x + c\right )^{5} + 15 \, a b^{3} \tan \left (d x + c\right )^{4} + 5 \, {\left (6 \, a^{2} b^{2} - b^{4}\right )} \tan \left (d x + c\right )^{3} - 15 \, {\left (a^{4} - 6 \, a^{2} b^{2} + b^{4}\right )} d x + 30 \, {\left (a^{3} b - a b^{3}\right )} \tan \left (d x + c\right )^{2} + 30 \, {\left (a^{3} b - a b^{3}\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 15 \, {\left (a^{4} - 6 \, a^{2} b^{2} + b^{4}\right )} \tan \left (d x + c\right )}{15 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A]
time = 0.17, size = 214, normalized size = 1.67 \begin {gather*} \begin {cases} - a^{4} x + \frac {a^{4} \tan {\left (c + d x \right )}}{d} - \frac {2 a^{3} b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} + \frac {2 a^{3} b \tan ^{2}{\left (c + d x \right )}}{d} + 6 a^{2} b^{2} x + \frac {2 a^{2} b^{2} \tan ^{3}{\left (c + d x \right )}}{d} - \frac {6 a^{2} b^{2} \tan {\left (c + d x \right )}}{d} + \frac {2 a b^{3} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} + \frac {a b^{3} \tan ^{4}{\left (c + d x \right )}}{d} - \frac {2 a b^{3} \tan ^{2}{\left (c + d x \right )}}{d} - b^{4} x + \frac {b^{4} \tan ^{5}{\left (c + d x \right )}}{5 d} - \frac {b^{4} \tan ^{3}{\left (c + d x \right )}}{3 d} + \frac {b^{4} \tan {\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\x \left (a + b \tan {\left (c \right )}\right )^{4} \tan ^{2}{\left (c \right )} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 2281 vs.
\(2 (124) = 248\).
time = 2.83, size = 2281, normalized size = 17.82 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 3.98, size = 221, normalized size = 1.73 \begin {gather*} \frac {\ln \left ({\mathrm {tan}\left (c+d\,x\right )}^2+1\right )\,\left (2\,a\,b^3-2\,a^3\,b\right )}{d}-\frac {{\mathrm {tan}\left (c+d\,x\right )}^3\,\left (\frac {b^4}{3}-2\,a^2\,b^2\right )}{d}-\frac {{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (2\,a\,b^3-2\,a^3\,b\right )}{d}+\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (a^4-6\,a^2\,b^2+b^4\right )}{d}+\frac {b^4\,{\mathrm {tan}\left (c+d\,x\right )}^5}{5\,d}-\frac {\mathrm {atan}\left (\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (-a^2+2\,a\,b+b^2\right )\,\left (a^2+2\,a\,b-b^2\right )}{a^4-6\,a^2\,b^2+b^4}\right )\,\left (-a^2+2\,a\,b+b^2\right )\,\left (a^2+2\,a\,b-b^2\right )}{d}+\frac {a\,b^3\,{\mathrm {tan}\left (c+d\,x\right )}^4}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________